Skip to content

[KYUUBI #7738][AUTHZ] Keep PermanentViewMarker.newInstance() canonically equal to the original - #7739

Open
j1wonpark wants to merge 1 commit into
apache:masterfrom
j1wonpark:KYUUBI-7738
Open

[KYUUBI #7738][AUTHZ] Keep PermanentViewMarker.newInstance() canonically equal to the original#7739
j1wonpark wants to merge 1 commit into
apache:masterfrom
j1wonpark:KYUUBI-7738

Conversation

@j1wonpark

Copy link
Copy Markdown
Contributor

Why are the changes needed?

Fixes #7738.

newInstance() wraps the child in a Project, and three things kept that Project in the
canonical form, so a renewed marker was not sameResult with the original and CacheManager
could not find the cache.

Dropping the Cast lets Spark's own rename-only Project stripping apply. That stripping
arrived in SPARK-51109, so it is absent on 3.5; on 4.0 the backported condition requires
alias.explicitMetadata.isEmpty and PVM passes Some(attr.metadata), so it does not apply
there either. The guard is the only mechanism on those two versions, hence both changes.

Matching on the tag alone drops two conditions the guard does not need — that the child is a
View, and that there is a single layer. Both are violated in practice: markers over subquery
plans have a non-View child, and a renewed marker reused in another query gains a second
Project.

How was this patch tested?

Three unit assertions in a new PermanentViewMarkerSuite, one per cause, and a plan level
check next to [KYUUBI #3411] skip checking cache table in RangerSparkExtensionSuite that
also covers the nested shape.

Spark as shipped Cast removed only this patch
3.5 3 of 3 fail 2 of 3 fail pass
4.0 3 of 3 fail 2 of 3 fail pass
4.1 3 of 3 fail pass pass

70 tests pass on 3.5 and on 4.1 (PermanentViewMarkerSuite plus the Hive and in-memory catalog
RangerSparkExtensionSuite), and the masking and row filtering suites are unchanged.

Was this patch assisted by generative AI tooling?

Assisted-by: Claude Opus 5

…nonically equal to the original

newInstance() wraps the child in a Project that survives canonicalization, so a renewed
marker is not sameResult with the original and a cached permanent view is read again.
Drop the Cast that blocks Spark's rename-only Project stripping, and match on the tag
alone so the guard covers any depth and any child.

Assisted-by: Claude Opus 5
Signed-off-by: Jiwon Park <jiwonpark@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] A cached permanent view is re-read when referenced twice in one query

1 participant